import request from '@/utils/request.js';
import { useTokenStore } from '@/stores/token.js';

// 文章分类列表查询
export const articleCategoryListService = () => {
    return request.get('/category');
}

// 文章分类添加
export const articleCategoryAddService = (categoryData) => {
    return request.post('/category', categoryData);
}

// 文章分类修改
export const articleCategoryUpdateService = (categoryData) => {
    return request.put('/category', categoryData);
}

// 文章分类删除
export const articleCategoryDeleteService = (id) => {
    return request.delete('/category?id=' + id);
}

// 文章列表查询
export const articleListService = (params) => {
    return request.get('/article/list', { params: params });
}

// 文章添加
export const articleAddService = (articleData) => {
    return request.post('/article/add', articleData);
}

// 文章修改
export const articleUpdateService = (articleData) => {
    return request.put('/article/update', articleData);
}

// 文章删除
export const articleDeleteService = (id) => {
    return request.delete('/article/' + id);
}

// 移动文章到回收站
export const moveToTrashService = (id) => {
    return request.post('/article/trash', { id });
}

// 从回收站恢复文章
export const articleRestoreService = (id) => {
    return request.post('/article/restore', { id });
}

// 从回收站永久删除文章
export const articleDeleteForeverService = (id) => {
    return request.delete('/article/trash/' + id);
}